import { CellRenderer } from "../../../../../fl/controls/listClasses/CellRenderer";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ObjCreate } from "../../common/ObjCreate";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { Language } from "../../../../../extend/language/Language";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { FriendInfo } from "../../../model/FriendInfo";
import { GButton } from "../../../../../com/mui/controls/GButton";
//class BulkDeleteDelCellRendener
    
    export  class BulkDeleteDelCellRendener extends CellRenderer
    {
        constructor()
        {
            super();
            this.initStyles();
            this.create();
            this.mouseEnabled = false;
            this.mouseChildren = true;
            return;
        }

        /* internal  */initStyles(): void
        {
            this.setStyle("downSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("overSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("upSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedDownSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("selectedOverSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("selectedUpSkin", GlobalClass.getBitmap("Friend_over"));
            return;
        }

        /* internal  */create(): void
        {
            this._tfFriendName = ObjCreate.createTextField("", 3, 4, 95, 20, this, GlobalStyle.textFormat6);
            this._btnCancel = ObjCreate.createGButton(Language.getString(43532), 92, 0, 46, 22, this);
            this._btnCancel.addEventListener(flash.events.MouseEvent.CLICK, this.onCancelClick);
            return;
        }

        /* internal  */onCancelClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this._friendInfo) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.FriendBulkDelRemoveFromRight, this._friendInfo));
            }
            return;
        }

        public /* override */ set label(arg1: string)
        {
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            if (typeof arg1 === "friendinfo") 
            {
                this._friendInfo = arg1 as FriendInfo;
                this.updateView();
            }
            return;
        }

        /* internal  */updateView(): void
        {
            this._tfFriendName.text = this._friendInfo.friendPlayerInfo.playerName;
            this._btnCancel.enabled = true;
            this._btnCancel.drawNow();
            return;
        }

        /* internal */ /* var */_tfFriendName: Object /* flash.text.TextField */;

        /* internal */ /* var */_btnCancel: GButton;

        /* internal */ /* var */_friendInfo: FriendInfo;
    }
